﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="EZCRS.HCMS.Web.manage.baseinfo.baseinfo" Codebehind="baseinfo.aspx.cs" %>

<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
   <title></title>
   <link type="text/css" href="../../style/main.css" rel="Stylesheet" /> 
</head>
<body>
    <form id="form1" runat="server">
        <uc2:titlepage id="Titlepage1" runat="server" inittitle="<%$ Resources:Site, BaseInfoTitle %>"></uc2:titlepage>
        
        <table class="main-table"  cellpadding="1" cellspacing="1">
            <tr class="line-even">
                <td style="width:10%; text-align: right;">
                    &nbsp;</td>
                <td width="19%" style="text-align: left;">
                    类别：<asp:DropDownList ID="ddllanguage" runat="server">
                        
                    </asp:DropDownList>
                    &nbsp;<asp:Button  ID="BtnSearch"  runat="server" CssClass="bttn" OnClientClick="javascript:search();return false;" Text="<%$ Resources:Site, ButtonSearch %>" />
                    </td>
                <td  style="width: 20%">
                    &nbsp;</td>
            </tr>
            
            </table>
        <br />
        <div id="tablist"></div>
   <script type="text/javascript">
    function search()
    {//debugger
        var sstr=$F("ddllanguage").value.split('|');
        var strid=sstr[0];
        var strcode=sstr[1];
        EZCRS.HCMS.myajax.AjaxBaseInfo.getbaseinfotype(strid,strcode,function(resp){$F("tablist").innerHTML=resp.value;if(strcode=="1"){rowaddnew('tlist');}else{if(gethid()=="0" && getgid()=="0"){rowaddnew('tlist');}}});
    }
    function del(obj)
    {
      if(confirm('确信要删除？'))
      {
        var strid=obj.parentElement.parentElement.cells[0].innerHTML;
        EZCRS.HCMS.myajax.AjaxBaseInfo.deletebaseinfo(strid,function(resp){if(resp.value=="1"){obj.parentElement.parentElement.style.display='none';};});
      }
    }
    function save(obj,cellstart,cellend)
    {
      var sstr=$F("ddllanguage").value.split('|');
      var strid=sstr[0];
      var strcode=sstr[1];
      var crow=obj.parentElement.parentElement;
      var jsid=crow.cells[0].innerHTML;
      var jscode=crow.cells[1].childNodes[0].value;
      var jsname=crow.cells[2].childNodes[0].value;
      var jsrank=crow.cells[3].childNodes[0].value;
      var jspid=crow.cells[4].childNodes[0].value;
      var jstype=strid;
      EZCRS.HCMS.myajax.AjaxBaseInfo.updatebaseinfo(jsid,jscode,jsname,jsrank,jspid,jstype,function(resp){if(resp.value=="1"){rowreset(obj,cellstart,cellend,'');}else{alert('发生错误，稍后再试！');}});
    }
    
    search();
    //新增一空行准备添加
    function rowaddnew(str)
    {
      var ttable=$F(str);
      if(ttable==null)
       return;
      var ctr=ttable.insertRow(-1);
      
      var ctd0=document.createElement("td");
      ctd0.innerHTML="0";
      ctr.appendChild(ctd0);
      
      var ctd1=document.createElement("td");
      ctd1.innerHTML="<input type=\"text\" class=\"text-line\">";
      ctr.appendChild(ctd1);
      
      var ctd2=document.createElement("td");
      ctd2.innerHTML="<input type=\"text\" class=\"text-line\" style=\"width:250px;\">";
      ctr.appendChild(ctd2);
      
      var ctd3=document.createElement("td");
      ctd3.innerHTML="<input type=\"text\" class=\"text-line\" style=\"width:50px;\">";
      ctr.appendChild(ctd3);
      
      var ctd4=document.createElement("td");
      ctd4.innerHTML="<input type=\"text\" class=\"text-line\" style=\"width:50px;\" value=\""+getpid()+"\">";
      ctr.appendChild(ctd4);
      
      var ctd3=document.createElement("td");
      ctd3.innerHTML="<input type=\"button\" value=\"添加\" class=\"bttn\" onclick=\"save(this,1,4);search();\">";
      ctr.appendChild(ctd3);
    }
   </script> 
    </form> 
</body>
</html>
